﻿using System.Drawing;
using System.Windows.Forms;

public class CustomButton : Button
{
    public CustomButton()
    {
        // 禁用按钮的视觉样式，以便自定义绘制
        this.FlatStyle = FlatStyle.Flat;
        this.FlatAppearance.BorderSize = 0;
        this.FlatAppearance.MouseDownBackColor = this.BackColor;
        this.FlatAppearance.MouseOverBackColor = this.BackColor;
        this.Size = new System.Drawing.Size(180, 33);
    }

    protected override void OnMouseEnter(System.EventArgs e)
    {
        // 不调用基类方法，以防止颜色变化
    }

    protected override void OnMouseLeave(System.EventArgs e)
    {
        // 不调用基类方法，以防止颜色变化
    }

    protected override void OnPaint(PaintEventArgs pevent)
    {
        base.OnPaint(pevent);
        // 在这里可以进行自定义绘制，如果需要
    }
}
